package com.frxuexi.lib_http

import com.zyj.retrofit.adapter.FlowCallAdapterFactory
import okhttp3.Interceptor
import okhttp3.Response
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

class TokenRetrofitImpl:BaseRetrofitImpl() {
    override fun createRetrofit(): Retrofit {
        val builder = createOkhttpBuilder()
        builder.addInterceptor(object :Interceptor{
            override fun intercept(chain: Interceptor.Chain): Response {
                val request = chain.request()
                request.newBuilder().addHeader("token", "")
                return chain.proceed(request)
            }
        })
        return Retrofit.Builder()
            .baseUrl(Concast.BASE_URL)
            .client(builder.build())
            .addConverterFactory(GsonConverterFactory.create())
            .addCallAdapterFactory(FlowCallAdapterFactory.create())
            .build()
    }
}